package com.chushouya.controller.product.api;

import com.chushouya.common.annotations.AuthSkip;
import com.chushouya.common.annotations.AuthValidate;
import com.chushouya.common.constant.ServiceType;
import com.chushouya.product.dto.api.evaluate.*;
import com.general.framework.core.schema.Response;
import com.chushouya.product.service.api.EvaluateApiService;
import com.chushouya.product.service.api.EvaluateDataApiService;
import com.chushouya.product.service.api.VisitDeviceApiService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@Api(tags =  ServiceType.API + "估价接口")
@RestController
@RequestMapping( ServiceType.API + "/evaluate")
@Slf4j
public class EvaluateApiController {
    @Resource
    private EvaluateApiService evaluateApiService;

    @Resource
    private EvaluateDataApiService evaluateDataApiService;
    
    @Resource
    private VisitDeviceApiService visitDeviceApiService;

    @AuthSkip
    @ApiOperation("获取本机机型接口")
    @GetMapping("visitDevice")
    public Response<VisitDeviceApiDTO> visitDevice(@Validated VisitDeviceRequestApiDTO request) {
        return Response.success(visitDeviceApiService.visitDevice(request));
    }


    @AuthSkip
    @ApiOperation("获取产品主数据接口")
    @GetMapping("product")
    public Response<EvaluateProductApiDTO> evaluateProduct(@Validated EvaluateProductRequestApiDTO request) {
        return Response.success(evaluateApiService.evaluateProduct(request));
    }

    @AuthSkip
    @ApiOperation("获取产品评估项列表")
    @GetMapping("item")
    public Response<EvaluateItemApiDTO> evaluateItem(@Validated EvaluateItemRequestApiDTO request) {
        return Response.success(evaluateApiService.evaluateItem(request));
    }


    @AuthValidate
    @ApiOperation("获取估价数据接口")
    @PostMapping("result")
    public Response<EvaluateResultApiDTO> result(@RequestBody @Validated EvaluateRequestApiDTO request) {
        return Response.success(evaluateApiService.evaluateResult(request));
    }

    @AuthSkip
    @ApiOperation("获取是否可以上门")
    @GetMapping("recycleWay")
    public Response<Void> recycleWay() {
        return Response.success();
    }

}
